<template>
    <div class="quickNav">
        <div class="nav">
            <div class="iconList">
                <ul>
                    <routerLink :to="{ name: 'home' }">
                        <i class="iconfont">&#xe61b;</i>
                        <span> 首页</span>
                    </routerLink>
                    <routerLink to="/search">
                        <i class="iconfont">&#xe67f;</i>
                        <span> 搜索</span>
                    </routerLink>
                    <routerLink to="/catalog">
                        <i class="iconfont">&#xe600; </i>
                        <span> 分类</span>
                    </routerLink>
                    <routerLink to="/cart">
                        <i class="iconfont">&#xe655;</i>
                        <span>购物车</span>
                    </routerLink>
                    <routerLink to="/user">
                        <i class="iconfont">&#xe7ab;</i>
                        <span> 个人中心</span>
                    </routerLink>
                    <a></a>
                </ul>
            </div>
            <div class="quickIcon" @click="useNav">
                快速导航
            </div>
        </div>
        <div class="show"></div>
    </div>
</template>

<script>
export default {
    data() {
        return {
            isNavShow: false
        }
    },
    methods: {
        useNav() {
            const navList = document.querySelector('.iconList')
            const show = document.querySelector('.show')

            if (this.isNavShow) {
                this.isNavShow = false
                navList.style.transform = 'scaleY(0)'
                show.classList.remove('active')
                return
            }
            else {
                this.isNavShow = true
                navList.style.transform = 'scaleY(1)'
                show.classList.add('active')
                return
            }
        }
    }
}
</script>

<style scoped>
.quickNav {
    width: 100%;
    height: 100%;
    position: relative;

    .show {
        width: 100vw;
        height: 100vh;
        background-color: #000;
        opacity: 0.3;
        position: fixed;
        display: none;
        z-index: 98;
    }
    .show.active{
        display: block;
    }

    .nav {
        width: 12vw;
        height: 72vw;
        border-radius: 6.6667vw;
        overflow: hidden;
        position: fixed;
        right: 2.6667vw;
        bottom: 36vw;
        z-index: 99;

        .iconList {
            width: 12vw;
            transition: all 0.3s;
            transform-origin: bottom;
            transform: scaleY(0);

            ul {
                width: 12vw;
                display: flex;
                flex-direction: column;
                border-radius: 6.6667vw;
                background-color: #f4f4f4;

                a {
                    width: 12vw;
                    height: 12vw;
                    text-decoration: none;
                    color: #666;
                    display: flex;
                    justify-content: center;
                    gap: 1.3333vw;
                    flex-direction: column;

                    i.iconfont {
                        font-size: 4vw;
                        font-weight: bold;
                    }

                    span {
                        font-size: 2.1333vw;
                    }
                }
            }
        }

        .quickIcon {
            width: 12vw;
            height: 12vw;
            border-radius: 50%;
            background-color: red;
            color: #fff;
            font-size: 3.2vw;
            line-height: 4.6667vw;
            box-sizing: border-box;
            padding: 1.3333vw;
            position: relative;
            top: -12vw;

        }
    }
}
</style>